<?php
// 2011-06-12 14:27
class BookAddAction extends Action
{
    /**
    +----------------------------------------------------------
    * 默认操作
    +----------------------------------------------------------
    */
    public function index()
    {	
				//$School = M("School");
				//$Schoollist=$School->where("isschool=1")->order("id asc")->select();
			 	//$this->assign("Schoollist", $Schoollist);
			 	
    		$this->Pagetype = '1';
    		
    		//dump(__ROOT__);
        $this->display(APP_PATH.'/Tpl/default/book_add.html');
    }
    
    // 处理表单数据
    /**
    public function Add()
    {
			$Form	=	D("school");
			if($Form->create()) {
				if(false !==$Form->add()) {
	    			$this->success('数据添加成功！');
	            }else{
	                $this->error('数据写入错误');
	            }
			}else{
				header("Content-Type:text/html; charset=utf-8");
				exit($Form->getError().' [ <A HREF="javascript:history.back()">返 回</A> ]');
			}
    }
    */
    
    public function Add()
    {			
			/* Method 3 */
			$CityInfo	=	M("City1");
			//$CityInfo->create($data);
			$data['markid'] = $_POST['markid'];
			$data['type'] = $_POST['type'];
			$data['name'] = $_POST['name'];
			$CityInfo->add($data);
			$this->Pagetype = '1';
			$this->display(APP_PATH.'/Tpl/default/city_add.html');
    }
		
		
		public function Edit()
		{
			$CityInfo	=	M("City1");
			$data = $CityInfo->where("id=".$_GET['id'])->find();
			$this->assign('City', $data);
			$this->Pagetype = '2';
			$this->display(APP_PATH.'/Tpl/default/city_add.html');
		}
		
		public function Save()
		{
			$CityInfo	=	M("City1");
			$data['markid'] = $_POST['markid'];
			$data['type'] = $_POST['type'];
			$data['name'] = $_POST['name'];
			$CityInfo->where("id=".$_POST['id'])->save($data);
			$this->Pagetype = '1';
			$this->display(APP_PATH.'/Tpl/default/city_add.html');
		}
		
		public function View()
		{
			$CityInfo	=	M("City1");
			$data = $CityInfo->where("id=".$_GET['id'])->find();
			$this->assign('City', $data);
			$this->Pagetype = '3';
			$this->display(APP_PATH.'/Tpl/default/city_add.html');
		}

}
?>